# Maintainer: Kyle Keen <keenerd@gmail.com>
# Contributor: ViNS <gladiator@fastwebnet.it>
# Contributor: Daenyth
pkgname=nethogs
pkgver=0.8.7
pkgrel=1
pkgdesc="A net top tool which displays traffic used per process instead of per IP or interface"
url="https://github.com/raboof/nethogs"
license=('GPL')
depends=('libpcap' 'ncurses' 'gcc-libs')
arch=('loong64' 'x86_64')
#source=(http://downloads.sourceforge.net/$pkgname/$pkgname-$pkgver.tar.gz
source=(nethogs-$pkgver.tgz::https://github.com/raboof/nethogs/archive/v$pkgver.tar.gz)
md5sums=('7ce60a20b2de1bbd7b05f06384ffdeaf')

prepare() {
  cd "$srcdir/$pkgname-$pkgver"

  sed -i 's|/sbin|/bin|' src/MakeApp.mk
  sed -i 's|/local||'  Makefile
}

build() {
  cd "$srcdir/$pkgname-$pkgver"
  make prefix="/usr"
  make prefix="/usr" libnethogs
}

package() {
  cd "$srcdir/$pkgname-$pkgver"
  make prefix="/usr" DESTDIR="$pkgdir" install
  make prefix="/usr" DESTDIR="$pkgdir" install_lib
  # todo: report these upstream
  install -Dm755 src/libnethogs.h "$pkgdir/usr/include/libnethogs.h"
  ln -s "/usr/lib/libnethogs.so.$pkgver" "$pkgdir/usr/lib/libnethogs.so"
}
# vim:set ts=2 sw=2 et:
